﻿Imports QLTHUVIEN.DTO

Public Class BangCapDAO
    Public Function LayDanhSach() As DataTable
        Dim strSql As String = "SELECT MaBangCap, TenBangCap FROM BANGCAP WHERE isDelete = 'False'"
        Dim dt As DataTable = DataProvider.ExecuteQuery(strSql)
        Return dt
    End Function

    Public Sub ThemBangCap(ByVal bangcap As BangCapDTO)
        Dim strSql As String = "INSERT INTO BANGCAP(TenBangCap) VALUES(N'" & bangcap.TenBangCap & "')"
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub SuaBangCap(ByVal bangcap As BangCapDTO)
        Dim strSql As String = "UPDATE BANGCAP SET TenBangCap =N'" & bangcap.TenBangCap & "' WHERE MaBangCap = " & bangcap.MaBangCap
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub XoaBangCap(ByVal bangcap As BangCapDTO)
        Dim strSql As String = "UPDATE BANGCAP SET isDelete ='" & bangcap.IsDelete.ToString() & "' WHERE MaBangCap = " & bangcap.MaBangCap
        DataProvider.ExecuteQuery(strSql)
    End Sub
End Class
